<template>
<el-dialog :visible.sync="visible" top v-dialogDrag :title="'查看' + title + '变更历史'" :fullscreen="isfullscreen" :close-on-click-modal="false" class="tl-dialog" width="1200px" @open="open" @close="close" append-to-body>
  <div>
    <div class="tl-form-line-title sub-title">
      <i v-if="!isfullscreen" @click="changeScreen" class="el-icon-full-screen" style="font-size: 25px;position:absolute;right:55px;top:18px;cursor:pointer" title="最大化"></i>
      <i v-else @click="changeScreen" class="el-icon-copy-document" style="font-size: 25px;position:absolute;right:55px;top:18px;cursor:pointer" title="还原"></i>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
        <el-table-column prop="modifiedon" label="修改时间" width="200px" sortable="custom" align="center" header-align="center" :formatter="dateDynamicColumn" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="scoringitem_big_catergory" label="评分项目（大类）" width="150px" sortable="custom" sort-by="scoringitem_big_catergory" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="scoringitem_small_catergory" label="评分项目（小类）" width="150px" sortable="custom" sort-by="scoringitem_small_catergory" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="scoringrubric" label="评分细则"   align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="scoredescription" label="细则描述" width="150px"  align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="fullscore" label="满分" width="50px" sortable="custom" sort-by="fullscore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="selfscore" label="自评分" width="70px" sortable="custom" sort-by="selfscore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="targetscore" label="目标得分" width="85px" sortable="custom" sort-by="targetscore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="scoregap" label="分差" width="50px" sortable="custom" sort-by="scoregap" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="dispisexpertguide" label="专家指导" width="100px" sortable="custom" sort-by="isexpertguide" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="gapanalysis" label="基于专家意见的差距分析" width="150px" sortable="custom" sort-by="gapanalysis" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<el-table-column prop="scoringplan" label="提分计划" sortable="custom" sort-by="scoringplan" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column>
				<!-- <el-table-column prop="responsible" label="责任人" width="70px" sortable="custom" sort-by="responsible" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
        <!-- <el-table-column prop="completion" label="进度更新" sortable="custom" width="80px" sort-by="completion" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
				<!-- <el-table-column prop="completionscore" label="完成得分" width="80px" sortable="custom" sort-by="completionscore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
				<!-- <el-table-column prop="planenddate" label="计划完成日期" width="110px" sortable="custom" sort-by="planenddate" align="center" :formatter="dateDynamicColumnToDay" header-align="center" :show-overflow-tooltip="true"></el-table-column> -->
        <!-- <el-table-column prop="improvescore" label="本周提升分数" width="110px" sortable="custom" sort-by="improvescore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
				<!-- <el-table-column v-if="times === '2'" prop="feedbackscore"  width="150px" label="专家反馈得分" sortable="custom" sort-by="feedbackscore" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
				<!-- <el-table-column v-if="times === '2'" prop="lossscorepoint" label="失分点" width="150px" sortable="custom" sort-by="lossscorepoint" align="left" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
				<!-- <el-table-column v-if="times === '2'" prop="improvementsuggestion" label="改进意见" width="150px" sortable="custom" sort-by="improvementsuggestion" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dynamicColumn"></el-table-column> -->
      </el-table>
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
    </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './edit'
import tlFeedBackScore from './feedBackScore'
import tlChangeEdit from './changeEdit'
/** 工具类 */
import { formatDate } from "@tapui/utils/date"
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
import { checkPermission } from '@tapui/utils/permission'
export default {
  name: 'mpmProjectBidScore',
  mixins: [mixin_list],
  components: { tlEdit, tlFeedBackScore, tlChangeEdit },
  data() {
    return {
      description: '评标细则信息表-列表查询',
      urlPrefix: '/mpm/projectBidScoreHis/',
      url: {
        queryCodeList: '/mpm/projectBidScore/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc'
      },
      selfscoretotal: 0,
      targetscoretotal: 0,
      visible: false,
      tableHeight: document.body.getBoundingClientRect().height - 150,
      isfullscreen: false,
      sourceid: 0
    }
  },
  props: {
    projectinfo: {},
    title: {
      type: [String],
      default: ''
    },
    times: {
      type: [String],
      default: '1'
    },
    type: {
      type: [String],
      default: '1'
    },
    // 是否来自复盘页面
    fromReview: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    dynamicColumn(row, column) {
      if (row.changefieldlist.includes(column.sortBy) || row.changefieldlist.includes(column.property)) {
        return <div style='background-color:yellow'>{row[column.property]}&nbsp;</div>
      } else {
        return row[column.property]
      }
    },
     dateDynamicColumnToDay(row, column) {
      const dateValue = row[column.property]
      if (dateValue) {
        const dispValue = formatDate(new Date(dateValue), "yyyy-MM-dd")
        if (row.changefieldlist.includes(column.sortBy)) {
          return <div style='background-color:yellow'>{dispValue}&nbsp;</div>
        } else {
          return dispValue
        }
      }
    },
    dateDynamicColumn(row, column) {
      const dateValue = row[column.property]
      if (dateValue) {
        const dispValue = formatDate(new Date(dateValue), "yyyy-MM-dd HH:mm:ss")
        if (row.changefieldlist.includes(column.sortBy)) {
          return <div style='background-color:yellow'>{dispValue}&nbsp;</div>
        } else {
          return dispValue
        }
      }
    },
    // 关闭函数
    close() {
      this.visible = false
    },
    changeScreen() {
      if (this.isfullscreen) {
        this.isfullscreen = false
      } else {
        this.isfullscreen = true
      }
    },
    // 禁用表格前面的选择
    doDisableCheckBox(row, index) {
      if (row.state !== 0 && row.state !== 2) {
        return false
      } else {
        return true
      }
    },
    open() {
      this.$nextTick(() => {
        this.loadData({ currentPage: 1 })
      })
    },
    beforeLoadData() {
      this.queryParam.qry_sourceid = this.sourceid
      this.queryParam.qry_type = this.type
      this.queryParam.qry_times = this.times
      this.queryParam.qry_sourcetype = 'MpmProjectBidScore'
      return true
    }
  }
}
</script>

<style scoped></style>

